<!DOCTYPE html>




<html class="theme-next gemini" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
    
  
  <link href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" rel="stylesheet" type="text/css">




  
  
  
  

  
    
    
  

  
    
      
    

    
  

  

  
    
      
    

    
  

  
    
      
    

    
  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Monda:300,300italic,400,400italic,700,700italic|Roboto Slab:300,300italic,400,400italic,700,700italic|Lobster Two:300,300italic,400,400italic,700,700italic|Source Code Pro:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






  

<link href="https://cdn.staticfile.org/font-awesome/4.6.2/css/font-awesome.css" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=6.0.0" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="http://tva3.sinaimg.cn/crop.206.47.515.515.180/709d5819jw8f4k1tlmnsij20pr0gytdx.jpg?v=6.0.0">


  <link rel="icon" type="image/png" sizes="32x32" href="http://tva3.sinaimg.cn/crop.206.47.515.515.180/709d5819jw8f4k1tlmnsij20pr0gytdx.jpg?v=6.0.0">


  <link rel="icon" type="image/png" sizes="16x16" href="http://tva3.sinaimg.cn/crop.206.47.515.515.180/709d5819jw8f4k1tlmnsij20pr0gytdx.jpg?v=6.0.0">


  <link rel="mask-icon" href="http://tva3.sinaimg.cn/crop.206.47.515.515.180/709d5819jw8f4k1tlmnsij20pr0gytdx.jpg?v=6.0.0" color="#222">





  <meta name="keywords" content="vps, java, python, golang, springmvc">




  


  <link rel="alternate" href="/atom.xml" title="张恒的网络日志" type="application/atom+xml">






<meta name="keywords" content="java, python, go, 技术, 学习笔记, spring">
<meta property="og:type" content="website">
<meta property="og:title" content="张恒的网络日志">
<meta property="og:url" content="http://blog.gavinzh.com/404.html">
<meta property="og:site_name" content="张恒的网络日志">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2020-01-05T08:52:36.912Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="张恒的网络日志">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '6.0.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    fastclick: true,
    lazyload: true,
    tabs: true,
    motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://blog.gavinzh.com/404.html">





  <title>VPS必知必会 | 张恒的网络日志</title>
  




<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-98061925-1', 'auto');
  ga('send', 'pageview');
</script>





</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"> <div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">张恒的网络日志</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">Zhang Heng's WebSite Blog</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.gavinzh.com/2017/07/05/VPS-learn/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Gavin Zhang">
      <meta itemprop="description" content>
      <meta itemprop="image" content="https://avatars3.githubusercontent.com/u/5567916">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="张恒的网络日志">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">VPS必知必会</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-07-05T05:59:00+00:00">2017-07-05</time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/VPS/" itemprop="url" rel="index">
                    <span itemprop="name">VPS</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/07/05/VPS-learn/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count" data-disqus-identifier="2017/07/05/VPS-learn/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          
             <span id="/2017/07/05/VPS-learn/" class="leancloud_visitors" data-flag-title="VPS必知必会">
               <span class="post-meta-divider">|</span>
               <span class="post-meta-item-icon">
                 <i class="fa fa-eye"></i>
               </span>
               
                 <span class="post-meta-item-text">阅读次数&#58;</span>
               
                 <span class="leancloud-visitors-count"></span>
             </span>
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>笔者是一位程序员，玩<code>vps</code>有一年多，以前玩过PaaS，IaaS，通俗的说，国内的大厂云主机都玩过。<br>相信很多刚刚了解<code>vps</code>的新手总是有各种各样的疑问，不管你们买vps是为了赚钱OR娱乐，这篇文章肯定能让你对<code>vps</code>有一个更深入的了解。</p>
<a id="more"></a>

<h2 id="Iaas、PaaS和SaaS"><a href="#Iaas、PaaS和SaaS" class="headerlink" title="Iaas、PaaS和SaaS"></a>Iaas、PaaS和SaaS</h2><p>首先，我们先看一张图</p>
<p><img src="/images/pasted-38.png" alt="upload successful"></p>
<p><code>IaaS</code>就是提供基础服务器资源，<code>PaaS</code>提供能运行你程序代码的环境，而<code>SaaS</code>提供的是具体的应用功能和数据存储服务。</p>
<h2 id="VPS是什么"><a href="#VPS是什么" class="headerlink" title="VPS是什么"></a>VPS是什么</h2><p>VPS（<strong>Virtual Private Server</strong>）即指<code>虚拟专用服务器</code>，是将一个服务器分区成多个虚拟独立专享服务器的技术。每个使用VPS技术的虚拟独立服务器拥有各自独立的公网IP地址、操作系统、硬盘空间、内存空间、CPU资源等，还可以进行安装程序、重启服务器等操作，与运行一台独立服务器完全相同。</p>
<p>也就是说通过软件层面，对一台服务器进行虚拟划分，虚拟出来多台服务器，这样就能让只需要一点点计算能力用户享用到大型服务器的计算资源。</p>
<p>在图一中，我们指的VPS就是直接由基础服务器虚拟出来的虚拟机。</p>
<h3 id="VPS和云服务器-云主机的区别"><a href="#VPS和云服务器-云主机的区别" class="headerlink" title="VPS和云服务器/云主机的区别"></a>VPS和云服务器/云主机的区别</h3><p>目前市面上各大厂商都推出了自己的云服务器，但是他们给自己的云服务器起了个别名。例如阿里云叫做<code>云服务器ECS</code>，腾讯云叫做<code>云服务器CVM</code>，微软Azure云叫做<code>虚拟机</code>。所以市面上的各种提供计算能力的机器不管叫什么名字，他们都是云服务器。</p>
<p>从广义上讲，云服务器就是VPS，只不过云服务器是在所有基础服务器或者虚拟机上虚拟化所有基础资源，例如内存带宽等等。而狭义的VPS仅在单台服务器上做虚拟化。</p>
<p>云服务器的优势在于它可以分布式存储数据，动态扩展基础资源。安全性和扩展性较强。</p>
<p>VPS如果想扩展资源那只能重新配置一台新的你需要的资源大小的服务器，然后把数据迁移过去，而分布式存储数据则无从谈起。</p>
<h3 id="VPS和云服务器的选择"><a href="#VPS和云服务器的选择" class="headerlink" title="VPS和云服务器的选择"></a>VPS和云服务器的选择</h3><p>如果作为一家互联网公司，推荐使用云服务器。原因如下：</p>
<ul>
<li>公司业务随时增加，用户量随之增加，服务器的压力也会增加。那么动态的扩容机器是公司必须考虑的。</li>
<li>云服务器的存储是分布式的，很难出现数据丢失的情况。基本上只有在这家云服务器厂商整个服务器崩溃才可能出现数据丢失。</li>
</ul>
<p>作为个人买家，则推荐VPS，VPS最重要的优势在于<code>价格低廉</code>。</p>
<h3 id="VPS和虚拟主机的区别"><a href="#VPS和虚拟主机的区别" class="headerlink" title="VPS和虚拟主机的区别"></a>VPS和虚拟主机的区别</h3><p>虚拟主机是指在网络服务器上分出一定的磁盘空间，用户可以租用此部分空间，以供用户放置站点及应用组件，提供必要的数据存放和传输功能。</p>
<p>它和VPS的区别很明显。虚拟主机只能放置你的网页程序代码，不能管理这台机器。也就是说VPS和云服务器是同一级别的概念，属于IaaS。而虚拟主机是在前者级别之上，属于PaaS。</p>
<p>国内有很多小厂，<strong>故意混淆两者概念</strong>，很容易上当，大家请务必注意这点。</p>
<p><a href="https://www.zhihu.com/question/21641778" target="_blank" rel="noopener">谁能举个通俗易懂的例子告诉我IAAS，SAAS，PAAS的区别？</a></p>
<h3 id="VPS评价标准"><a href="#VPS评价标准" class="headerlink" title="VPS评价标准"></a>VPS评价标准</h3><p>评价一款VPS主要有几方面：</p>
<ul>
<li>稳定性，稳定性不多说，你总不希望一年宕机好多次吧。</li>
<li>速度，速度决定了你访问的体验。</li>
<li>性价比，性价比是为了省钱。</li>
</ul>
<h4 id="稳定性"><a href="#稳定性" class="headerlink" title="稳定性"></a>稳定性</h4><p>稳定性决定因素很多，最重要的就是<code>母鸡</code>（对所虚拟化的机器的别称）的性能。VPS商家可能拥有很多不同性能的服务器，不同性能服务器虚拟化出来的VPS稳定性参差不齐，尽量选择新机器。</p>
<h4 id="速度"><a href="#速度" class="headerlink" title="速度"></a>速度</h4><p>速度是指访问VPS的速度，国内的话主要看所在机房对电信联通移动带宽的支持情况。国外则需要注意服务器所在机房连接大陆的路线，有些机房路由绕地球一大圈才到中国，这样肯定很慢。还有另一个因素出口带宽，电信拥有中国最大的出口带宽，其路线分为两种，一种是普通人使用的163骨干网，另一种是企业办公用的CN2骨干网。在带宽上运营商排名是：电信163&gt;电信CN2&gt;联通&gt;移动。但是，由于运营商服务人群不同，其人均带宽排名是：移动&gt;联通&gt;电信CN2&gt;电信163。</p>
<p>可以通过<a href="http://www.ipip.net/traceroute.php" target="_blank" rel="noopener">IPIP.NET</a>这个网站来查看机房路由情况。</p>
<p>测速的话，可以根据VPS商家提供测试下载文件进行测试速度。</p>
<h4 id="性价比"><a href="#性价比" class="headerlink" title="性价比"></a>性价比</h4><p>性价比则是稳定性速度和价格的比较。</p>
<h2 id="VPS分类"><a href="#VPS分类" class="headerlink" title="VPS分类"></a>VPS分类</h2><p>上文提到，VPS是通过软件将服务器的硬件资源进行划分生成多个虚拟服务器。而市面上常用的分类就是以虚拟化软件技术的不同而区分。</p>
<h3 id="OpenVZ"><a href="#OpenVZ" class="headerlink" title="OpenVZ"></a>OpenVZ</h3><p><code>OpenVZ</code>是一个开源软件，它是操作系统级服务器虚拟化的解决方案。由于它的解决方案太过强大，可以在有限的机器上虚拟出几乎无限的VPS，但是由于内存CPU还是那么少，所以分到每个VPS的资源（例如内存CPU）就极其有限，有时候虚拟化带来的开销甚至比用户正常使用的开销还大。</p>
<p><strong>优势</strong>:VPS中性价比最高。</p>
<p><strong>劣势</strong>:超卖，不能开VPN。</p>
<h3 id="KVM"><a href="#KVM" class="headerlink" title="KVM"></a>KVM</h3><p><code>KVM</code>是Kernel-based Virtual Machine的简称，它也是开源的系统虚拟化模块。由于它是基于硬件的虚拟化，导致它虚拟化的所有VPS的总内存只可能比真实服务器所拥有的内存小。</p>
<p><strong>优势</strong>:可以开VPN，独享内存。</p>
<p><strong>劣势</strong>:价格感人。</p>
<h3 id="XEN"><a href="#XEN" class="headerlink" title="XEN"></a>XEN</h3><p><code>XEN</code>是一个开放源代码虚拟机监视器，它对服务器硬件要求不高，可以有限的支持不同的操作系统（需要对操作系统源码做修改）。</p>
<p><strong>优势</strong>:同样的虚拟化，比上述两种效率要高。</p>
<p><strong>劣势</strong>:需要修改操作系统源码，维护不方便。</p>
<h3 id="VMware的ESX"><a href="#VMware的ESX" class="headerlink" title="VMware的ESX"></a>VMware的ESX</h3><p>是VMware公司的闭源产品，主要应用在大型企业内部。</p>
<h2 id="上手VPS"><a href="#上手VPS" class="headerlink" title="上手VPS"></a>上手VPS</h2><p>作为一个程序员，强烈建议大家优先选择Linux服务器，而不是Windows服务器。原因有一下几点：</p>
<ul>
<li>世界上大部分服务器是Linux系统，也就是说你遇到问题了，很容易百度/Google出问题。</li>
<li>Windows服务器占用内存大，你买的服务器本身内存就小，再加上操作系统，可供你应用的内存就更少了。</li>
<li>服务器端Linux的软件更多，大部分服务器软件优先支持Linux，而不是Windows。</li>
<li>省流量，Linux可以通过SSH连接，每次操作只用几KB流量，这样不仅省流量，对访问速度也是有提升的。</li>
</ul>
<p>最后一点：新手的话，Linux服务器务必选择Ubuntu最新版本，老手为了省时间也最好这么选择（血的教训）。</p>
<h3 id="连接到你的VPS"><a href="#连接到你的VPS" class="headerlink" title="连接到你的VPS"></a>连接到你的VPS</h3><p>一般情况下，VPS商家会在他们的网站上提供一个在线shell，供你连接到购买的VPS上。但是，这样的连接功能是有限的，例如上传下载都不好使。</p>
<p>在这里推荐一款在windows下连接linux机器的软件<a href="https://www.netsarang.com/products/xsh_overview.html" target="_blank" rel="noopener">Xshell5</a>。官方网站个人/教育行业免费下载，自带中文。</p>
<p>安装好Xshell5后，就可以连接你的VPS了。要注意你的协议是<code>SSH</code>，主机是你的VPS的IP地址，端口号是VPS商家提供的SSH端口号。如果没有提供，默认安装SSH的端口号是22。</p>
<h3 id="安装软件"><a href="#安装软件" class="headerlink" title="安装软件"></a>安装软件</h3><p>由于本人是程序员，安装软件全靠手动。如果有人想学习手动安装的话，可以参考这里<a href="http://cn.linux.vbird.org/" target="_blank" rel="noopener">鸟哥的Linux 私房菜</a></p>
<p>否则，请使用web控制面板，这里我也不是很熟悉，请参考<a href="https://www.zhihu.com/question/60868374" target="_blank" rel="noopener">有什么好用的vps管理控制面板。？</a></p>
<h3 id="数据备份"><a href="#数据备份" class="headerlink" title="数据备份"></a>数据备份</h3><p>一般来说，备份的内容包括<code>网页</code>，<code>php代码</code>，<code>数据库</code>。</p>
<p>像网页和代码的备份主要依靠FTP/Git。FTP推荐使用FileZilla，免费并且支持中文,<a href="https://filezilla-project.org/" target="_blank" rel="noopener">下载地址</a>。而作为程序员，我建议使用Git来进行代码和网页的备份，国外推荐<a href="https://github.com" target="_blank" rel="noopener">GitHub</a>，国内推荐<a href="https://git.oschina.net" target="_blank" rel="noopener">OschinaGit</a>。</p>
<p>像数据库，可以使用<code>phpmyadmin</code>来管理mysql，或使用命令<code>mysqldump</code>备份数据。</p>
<h3 id="特殊软件"><a href="#特殊软件" class="headerlink" title="特殊软件"></a>特殊软件</h3><p><a href="https://github.com/shadowsocks/shadowsocks/blob/master/README.md" target="_blank" rel="noopener">SS</a></p>
<h2 id="VPS商家选择"><a href="#VPS商家选择" class="headerlink" title="VPS商家选择"></a>VPS商家选择</h2><p>云服务器目前是两家独大，一是亚马逊云，二是阿里云。腾讯云被爆过不经用户同意擅自修改IP，京东云还不是很稳定，微软Azure云则发力太晚，被前两者占了先机。</p>
<p>而VPS则是百家争鸣的状态，因为做VPS的技术已经成熟了，VPS商家拼的就是服务水平。</p>
<h3 id="国内OR国外"><a href="#国内OR国外" class="headerlink" title="国内OR国外"></a>国内OR国外</h3><p>上文提到做VPS的技术已经成熟了，那么国内外的区别主要有以下几点：</p>
<ul>
<li>国内需要备案。</li>
<li>国内带宽价格昂贵导致同样机器国内的明显贵一些。</li>
<li>国外服务器由于跨洋，出口带宽因素，访问速度比国内慢。</li>
<li>国外商家很少有支持支付宝的。</li>
<li>国外VPS官网很少有支持中文。</li>
</ul>
<h3 id="便宜OR稳定"><a href="#便宜OR稳定" class="headerlink" title="便宜OR稳定"></a>便宜OR稳定</h3><p>便宜，稳定都是主管观点。”便宜没好货”的道理大家都懂。另外老鸟一直强调的：世上没有100%稳定的VPS，时刻记得备份数据！！低于$5的VPS是有，一般赶上大促或者一些超售主机商会提供这样的产品，不建议建站，这类主机建议学习用。新人的话，一般推荐<a href="https://bwh88.net/aff.php?aff=16787" target="_blank" rel="noopener">搬瓦工</a>，口碑还不错，价钱也很合适。</p>
<h3 id="月付OR年付"><a href="#月付OR年付" class="headerlink" title="月付OR年付"></a>月付OR年付</h3><p>如果是新接触VPS产品/商家，建议采用月付，如果你对于这家比较了解，甚至使用多年。从性价比角度考虑，有些VPS年付是比较便宜，我们可以选择年付。</p>
<h3 id="VPS类别选择"><a href="#VPS类别选择" class="headerlink" title="VPS类别选择"></a>VPS类别选择</h3><p>上边介绍了几种VPS的虚拟化方式。那么，该如何选择合适对的VPS呢？</p>
<ul>
<li>如果是做站，建议采用KVM，会比较稳定。</li>
<li>如果是存储，建议采用OpenVZ，价格便宜一些且磁盘空间大。</li>
</ul>
<h3 id="数据安全"><a href="#数据安全" class="headerlink" title="数据安全"></a>数据安全</h3><p>小的VPS商家很有可能因为资金周转原因倒闭什么的，大公司倒闭也不是没有。尽量选择大的公司会靠谱点，记得时常备份数据！！</p>
<h2 id="商家介绍"><a href="#商家介绍" class="headerlink" title="商家介绍"></a>商家介绍</h2><h3 id="搬瓦工"><a href="#搬瓦工" class="headerlink" title="搬瓦工"></a><a href="https://bwh88.net/aff.php?aff=16787" target="_blank" rel="noopener">搬瓦工</a></h3><p><img src="/images/pasted-39.png" alt="upload successful"></p>
<p>因其 <a href="https://bwh88.net/aff.php?aff=16787" target="_blank" rel="noopener">官网</a> 网站标识是BandwagonHost，有点类似BanWaGong的拼写，所以我们国内的站长喜欢称作为搬瓦工VPS。</p>
<p>搬瓦工VPS，隶属于美国IT7公司旗下的一款低价OpenVZ VPS主机方案、2017年新增KVM VPS架构，尤其是6款便宜年付VPS，无论从性价比还是稳定性都非常适合大众VPS用户需求，我们可以用来建站、搭建软件调试，也可以完成各种初学者需要测试项目使用。</p>
<p><a href="https://bwh88.net/aff.php?aff=16787&gid=1" target="_blank" rel="noopener"><strong>点击这里查看当前所有可购买搬瓦工方案</strong></a></p>
<p><a href="/2017/07/05/VPS-banwagong/"><strong>点击这里查看搬瓦工详细介绍</strong></a></p>
<h3 id="Linode"><a href="#Linode" class="headerlink" title="Linode"></a><a href="https://www.linode.com/?r=5f03a97cc24c01b9c13a025337072caa737e95b9" target="_blank" rel="noopener">Linode</a></h3><p><img src="/images/pasted-40.png" alt="upload successful"></p>
<p>Linode <a href="https://www.linode.com/?r=5f03a97cc24c01b9c13a025337072caa737e95b9" target="_blank" rel="noopener">官网</a> 一直是VPS主机界的“高富帅”的代表,主机不仅稳定，它的VPS主机管理面板也是功能强大。很多中国的站长都选择在Linode上建站，原因在于速度和稳定都比较好。Linode最低配置是5美元一月，都是KVM虚拟机，价格还是比较合适的。</p>
<p><a href="/2017/07/06/LinodeVPS/"><strong>点击这里查看搬瓦工详细介绍</strong></a></p>
<h3 id="Host1plus介绍"><a href="#Host1plus介绍" class="headerlink" title="Host1plus介绍"></a><a href="https://affiliates.host1plus.com/ref/host1plusfreecode.html" target="_blank" rel="noopener">Host1plus介绍</a></h3><p><img src="/images/pasted-41.png" alt="upload successful"></p>
<p>host1plus <a href="https://affiliates.host1plus.com/ref/host1plusfreecode.html" target="_blank" rel="noopener">官网</a>，成立于2008年，注册于英格兰和威尔士，在英国伦敦、立陶宛考纳斯、德国法兰克福均驻有办公室。早些年host1plus刚成立的时候，各种低端服务各种被怀疑跑路，连个自己的logo都没有。经历了七八年的时间洗礼，不仅活了下来，而且越来越正规。现在已经是少有的高性价比vps服务上了。如果你厌倦了美国想试试其他地方的VPS，那么不妨试试host1plus，毕竟他们的机房分布于德国、巴西、南非、美国四个不同地方，也是比较少见的多机房服务了。</p>
<p>现在不仅<strong>支持支付宝付款</strong>，还推出了中文面板与中文官网，据说连中文客服都已经配备了</p>
<p>支持TUN/TAP, NAT, PPP，可快速搭建科学上网服务</p>
<p><a href="https://affiliates.host1plus.com/affiliates/signup.php?a_aid=host1plusfreecode" target="_blank" rel="noopener"><strong>点击这里注册</strong></a></p>
<p><a href="/2017/07/12/Host1plusVPS/"><strong>点击这里查看详细介绍</strong></a></p>

      
    </div>
    
    
    

    

    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    Gavin Zhang
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://blog.gavinzh.com/2017/07/05/VPS-learn/" title="VPS必知必会">http://blog.gavinzh.com/2017/07/05/VPS-learn/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/VPS/" rel="tag"># VPS</a>
          
            <a href="/tags/Linode/" rel="tag"># Linode</a>
          
            <a href="/tags/搬瓦工/" rel="tag"># 搬瓦工</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/06/08/how-to-use-vue-i18n/" rel="next" title="vuejs国际化插件vue-i18n的使用">
                <i class="fa fa-chevron-left"></i> vuejs国际化插件vue-i18n的使用
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/07/05/VPS-banwagong/" rel="prev" title="搬瓦工VPS介绍|优惠码">
                搬瓦工VPS介绍|优惠码 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="https://avatars3.githubusercontent.com/u/5567916" alt="Gavin Zhang">
            
              <p class="site-author-name" itemprop="name">Gavin Zhang</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">129</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">158</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/jiangmitiao" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:me at gavinzh.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#Iaas、PaaS和SaaS"><span class="nav-number">1.</span> <span class="nav-text">Iaas、PaaS和SaaS</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#VPS是什么"><span class="nav-number">2.</span> <span class="nav-text">VPS是什么</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#VPS和云服务器-云主机的区别"><span class="nav-number">2.1.</span> <span class="nav-text">VPS和云服务器/云主机的区别</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#VPS和云服务器的选择"><span class="nav-number">2.2.</span> <span class="nav-text">VPS和云服务器的选择</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#VPS和虚拟主机的区别"><span class="nav-number">2.3.</span> <span class="nav-text">VPS和虚拟主机的区别</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#VPS评价标准"><span class="nav-number">2.4.</span> <span class="nav-text">VPS评价标准</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#稳定性"><span class="nav-number">2.4.1.</span> <span class="nav-text">稳定性</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#速度"><span class="nav-number">2.4.2.</span> <span class="nav-text">速度</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#性价比"><span class="nav-number">2.4.3.</span> <span class="nav-text">性价比</span></a></li></ol></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#VPS分类"><span class="nav-number">3.</span> <span class="nav-text">VPS分类</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#OpenVZ"><span class="nav-number">3.1.</span> <span class="nav-text">OpenVZ</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#KVM"><span class="nav-number">3.2.</span> <span class="nav-text">KVM</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#XEN"><span class="nav-number">3.3.</span> <span class="nav-text">XEN</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#VMware的ESX"><span class="nav-number">3.4.</span> <span class="nav-text">VMware的ESX</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#上手VPS"><span class="nav-number">4.</span> <span class="nav-text">上手VPS</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#连接到你的VPS"><span class="nav-number">4.1.</span> <span class="nav-text">连接到你的VPS</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装软件"><span class="nav-number">4.2.</span> <span class="nav-text">安装软件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数据备份"><span class="nav-number">4.3.</span> <span class="nav-text">数据备份</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#特殊软件"><span class="nav-number">4.4.</span> <span class="nav-text">特殊软件</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#VPS商家选择"><span class="nav-number">5.</span> <span class="nav-text">VPS商家选择</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#国内OR国外"><span class="nav-number">5.1.</span> <span class="nav-text">国内OR国外</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#便宜OR稳定"><span class="nav-number">5.2.</span> <span class="nav-text">便宜OR稳定</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#月付OR年付"><span class="nav-number">5.3.</span> <span class="nav-text">月付OR年付</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#VPS类别选择"><span class="nav-number">5.4.</span> <span class="nav-text">VPS类别选择</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#数据安全"><span class="nav-number">5.5.</span> <span class="nav-text">数据安全</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#商家介绍"><span class="nav-number">6.</span> <span class="nav-text">商家介绍</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#搬瓦工"><span class="nav-number">6.1.</span> <span class="nav-text">搬瓦工</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Linode"><span class="nav-number">6.2.</span> <span class="nav-text">Linode</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Host1plus介绍"><span class="nav-number">6.3.</span> <span class="nav-text">Host1plus介绍</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2013 &mdash; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Gavin Zhang</span>

  

  
</div>





<div>
	<a href="http://www.beian.miit.gov.cn/" target="_blank">陕ICP备17010002号-1</a>
</div>





        




  <script type="text/javascript">
    (function() {
      var hm = document.createElement("script");
      hm.src = "//tajs.qq.com/stats?sId=61868582";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




  <div style="display: none;">
    <script src="//s95.cnzz.com/z_stat.php?id=1261805793&web_id=1261805793" language="JavaScript"></script>
  </div>



        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>





  



  






  













  
  
    <script type="text/javascript" src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
  

  
  
    <script type="text/javascript" src="https://cdn.staticfile.org/fastclick/1.0.6/fastclick.js"></script>
  

  
  
    <script type="text/javascript" src="https://cdn.staticfile.org/jquery.lazyload/1.9.1/jquery.lazyload.min.js"></script>
  

  
  
    <script type="text/javascript" src="https://cdn.staticfile.org/velocity/2.0.5/velocity.min.js"></script>
  

  
  
    <script type="text/javascript" src="https://cdn.staticfile.org/velocity/2.0.5/velocity.min.js"></script>
  

  
  
    <script type="text/javascript" src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.0.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.0.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.0.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.0.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.0.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.0.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.0.0"></script>



  


  

    
      <script id="dsq-count-scr" src="https://zhang-hengs-website-blog.disqus.com/count.js" async></script>
    

    
      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'http://blog.gavinzh.com/2017/07/05/VPS-learn/';
          this.page.identifier = '2017/07/05/VPS-learn/';
          this.page.title = 'VPS必知必会';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://zhang-hengs-website-blog.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>
    

  




	





  














  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  
  <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script>
  <script>AV.initialize("EhAMmIXTRGtethTcgYwA9afH-gzGzoHsz", "jzP1TaBhMleAUgPLXyB0h8oQ");</script>
  <script>
    function showTime(Counter) {
      var query = new AV.Query(Counter);
      var entries = [];
      var $visitors = $(".leancloud_visitors");

      $visitors.each(function () {
        entries.push( $(this).attr("id").trim() );
      });

      query.containedIn('url', entries);
      query.find()
        .done(function (results) {
          var COUNT_CONTAINER_REF = '.leancloud-visitors-count';

          if (results.length === 0) {
            $visitors.find(COUNT_CONTAINER_REF).text(0);
            return;
          }

          for (var i = 0; i < results.length; i++) {
            var item = results[i];
            var url = item.get('url');
            var time = item.get('time');
            var element = document.getElementById(url);

            $(element).find(COUNT_CONTAINER_REF).text(time);
          }
          for(var i = 0; i < entries.length; i++) {
            var url = entries[i];
            var element = document.getElementById(url);
            var countSpan = $(element).find(COUNT_CONTAINER_REF);
            if( countSpan.text() == '') {
              countSpan.text(0);
            }
          }
        })
        .fail(function (object, error) {
          console.log("Error: " + error.code + " " + error.message);
        });
    }

    function addCount(Counter) {
      var $visitors = $(".leancloud_visitors");
      var url = $visitors.attr('id').trim();
      var title = $visitors.attr('data-flag-title').trim();
      var query = new AV.Query(Counter);

      query.equalTo("url", url);
      query.find({
        success: function(results) {
          if (results.length > 0) {
            var counter = results[0];
            counter.fetchWhenSave(true);
            counter.increment("time");
            counter.save(null, {
              success: function(counter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(counter.get('time'));
              },
              error: function(counter, error) {
                console.log('Failed to save Visitor num, with error message: ' + error.message);
              }
            });
          } else {
            var newcounter = new Counter();
            /* Set ACL */
            var acl = new AV.ACL();
            acl.setPublicReadAccess(true);
            acl.setPublicWriteAccess(true);
            newcounter.setACL(acl);
            /* End Set ACL */
            newcounter.set("title", title);
            newcounter.set("url", url);
            newcounter.set("time", 1);
            newcounter.save(null, {
              success: function(newcounter) {
                var $element = $(document.getElementById(url));
                $element.find('.leancloud-visitors-count').text(newcounter.get('time'));
              },
              error: function(newcounter, error) {
                console.log('Failed to create');
              }
            });
          }
        },
        error: function(error) {
          console.log('Error:' + error.code + " " + error.message);
        }
      });
    }

    $(function() {
      var Counter = AV.Object.extend("Counter");
      if ($('.leancloud_visitors').length == 1) {
        addCount(Counter);
      } else if ($('.post-title-link').length > 1) {
        showTime(Counter);
      }
    });
  </script>



  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  

  
  


  
  <script type="text/javascript" src="/js/src/js.cookie.js?v=6.0.0"></script>
  <script type="text/javascript" src="/js/src/scroll-cookie.js?v=6.0.0"></script>


  

</body>
</html>
